"""
内容：将评论显示隐藏设计成一个类
作者：赵柚桥
"""
# 引入模块

from ECshop.common.base import Base


# 创建一个根据会员名字进行删除的类
class ShowComments(Base):
    # 定义属性
    url = 'http://localhost:8080/ecshop/admin/'
    member_comment = ('css selector', 'a[href="comment_manage.php?act=list"]')
    frame_name_01 = 'menu-frame'
    frame_name_02 = 'main-frame'
    frame_name_03 = 'header-frame'
    tick = ('css selector', 'div[id=listDiv]>table>tbody>tr>th>input')
    drop_down_box = ('css selector', 'select[name="sel_action"]')
    suer_button = ('name', 'drop')
    # 定义方法
    """获取网页"""

    def page_login_open_web(self):
        self.base_open_web(self.url)

    # 进入导航栏frame
    def page_in_frame_01(self):
        self.base_in_frame(self.frame_name_03)

    """点击用户评论"""
    def page_click_user_comments(self):
        self.base_click(self.member_comment)

    # 退出导航栏frame
    def page_quit_frame_02(self):
        self.base_quit_frame()

    # 进入页面frame
    def page_in_frame_03(self):
        self.base_in_frame(self.frame_name_02)

    """点击勾选全部评论"""
    def page_click_tick(self):
        self.base_click(self.tick)

    """下拉框选择"""
    def page_drop_down_box(self):
        self.base_select(self.drop_down_box, '允许显示')
    """下拉框选择"""
    def page_drop_down_box_ban(self):
        self.base_select(self.drop_down_box, '禁止显示')

    """下拉框选择"""
    def page_drop_down_box_del(self):
        self.base_select(self.drop_down_box, '删除评论')

    """点击确定按钮"""
    def page_click_suer_button(self):
        self.base_click(self.suer_button)

    """点击弹窗确定"""
    def page_alert_button(self):
        self.base_alert()
    """断言"""
    def page_get_text_01(self):
        self.base_get_text('显示')

    def page_get_text_02(self):
        self.base_get_text('隐藏')
    """关闭"""
    def page_qiut(self):
        self.base_quit()

